﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class AdminUI : Form
    {
        int minFloor;
        int maxFloor;
        string namingConvention; 

        public AdminUI()
        {
            InitializeComponent();
        }

        private void startBttn_Click(object sender, EventArgs e)
        {
            // initialize the minFloor value
            initMinFloor();

            // initialize the maxFloor value
            initMaxFloor();

            // initialize the namingConvention value
            initNamingConvention(); 

            Elevator e1 = new Elevator(minFloor, maxFloor);
         
            new UCC.UCCSetupProgram(e1, minFloor, maxFloor, namingConvention).Run(); 
        }


        private void initMinFloor()
        {
            if (minFloor1.Checked)
            {
                minFloor = 1;
            }
            else if (minFloor2.Checked)
            {
                minFloor = 2;
            }
            else if (minFloor3.Checked)
            {
                minFloor = 3;
            }
            else if (minFloor4.Checked)
            {
                minFloor = 4;
            }
        }

        private void initMaxFloor()
        {
            if (maxFloor2.Checked)
            {
                maxFloor = 2;
            }
            else if (maxFloor3.Checked)
            {
                maxFloor = 3;
            }
            else if (maxFloor4.Checked)
            {
                maxFloor = 4;
            }
            else if (maxFloor5.Checked)
            {
                maxFloor = 5;
            }
        }

        private void initNamingConvention()
        {
            if (floorNameUK.Checked)
            {
                namingConvention = "UK";
            }
            else if (floorNameUS.Checked)
            {
                namingConvention = "US"; 
            }
        }

        private void minFloor1_CheckedChanged(object sender, EventArgs e)
        {
            maxFloor2.Enabled = true;
            maxFloor3.Enabled = true;
            maxFloor4.Enabled = true;
            maxFloor5.Enabled = true; 
        }

        private void minFloor2_CheckedChanged(object sender, EventArgs e)
        {
            maxFloor2.Enabled = false;
            maxFloor3.Enabled = true;
            maxFloor4.Enabled = true;
            maxFloor5.Enabled = true; 
        }

        private void minFloor3_CheckedChanged(object sender, EventArgs e)
        {
            maxFloor2.Enabled = false;
            maxFloor3.Enabled = false;
            maxFloor4.Enabled = true;
            maxFloor5.Enabled = true; 
        }

        private void minFloor4_CheckedChanged(object sender, EventArgs e)
        {
            maxFloor2.Enabled = false;
            maxFloor3.Enabled = false;
            maxFloor4.Enabled = false;
            maxFloor5.Enabled = true; 
        }
    }
}


